package com.thundersoft.pickcolor.viewholder;


import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;


import com.thundersoft.pickcolor.R;
import com.thundersoft.pickcolor.activity.ColorDetailsActivity;
import com.thundersoft.pickcolor.bean.Color;

public class TypeOneViewHolder extends TypeAbstractViewHolder {

    public TextView kind;
    private TextView tv_color_more;
    private Context mContext;

    public TypeOneViewHolder(View itemView) {
        super(itemView);
        mContext = itemView.getContext();
        kind = itemView.findViewById(R.id.tv_kind);
        tv_color_more = itemView.findViewById(R.id.tv_color_more);
    }

    @Override
    public void bindHolder(final Color color) {
        kind.setText(color.getKind());
        tv_color_more.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 跳转至详情页面(携带数据：kind)
                Intent intent = new Intent(mContext,ColorDetailsActivity.class);
                intent.putExtra("kind",color.getKind());
                mContext.startActivity(intent);
            }
        });
    }
}
